<?php
require_once './function.php';

$json = do_post_request("http://localhost:9095/getusermessage");
$list = json_decode($json, true);
?>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="Cache-Control" content="no-transform">
    <title>W-M-Learning</title>
    <link rel="shortcut icon" href="/Public/img/favicon.ico"/>
    <link href="./Public/css/bootstrap.css" rel="stylesheet">
    <link href="./Public/css/main.css" rel="stylesheet" type="text/css" charset="utf-8"/>
    <link href="./Public/css/index.css" rel="stylesheet" type="text/css" charset="utf-8"/>
    <link href="./Public/css/detail.css" rel="stylesheet" type="text/css" charset="utf-8"/>
    <link href="./Public/css/user.css" rel="stylesheet" type="text/css" charset="utf-8"/>
    <link href="./Public/css/announcement.css" rel="stylesheet" type="text/css" charset="utf-8"/>
    <link href="./Public/css/bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css" charset="utf-8"/>
    <script src="//cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <script src="//cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>
    <script>
        var rootUrl = '';
    </script>
</head>
<body>
<div class="container">

    <header class="header">
    <nav class="navbar navbar-default navbar-fixed-top">
        <div class="container">
            <div class="row">
                <div class="hidden-xs hidden-sm col-md-3 col-lg-3">
                    <div class="navbar-header navbar-left">
                        <a class="navbar-brand-mc" href="/">
                            <img src="./Public/img/logo.png" alt="logo"/>
                        </a>
                    </div>
                </div>
                <div class="hidden-xs visible-sm-block col-sm-2">
                    <div class="navbar-header navbar-left">
                        <a class="navbar-brand-mc" href="/">
                            <img src="/Public/img/Brand-M.png" alt="logo"/>
                        </a>
                    </div>
                </div>
                <div class="col-xs-8 col-sm-5 col-md-5 col-lg-5">
                     <!--<div class="navbar-search navbar-left">-->
                        <form class="navbar-form-mc" method="get" action="/course/search" role="search">
                            <div class="input-group input-group-nav">
                                <input type="text" class="form-control" id="input-search" name="key" placeholder="查找试卷...">
                                <span class="input-group-btn">
                                    <a role="button" href="search.html" style="background-image:url('/Public/img/icon-search.png');height:100%;" class="btn" aria-label="Left Align" onclick="$(this).closest('form').submit()">
                                    </a>
                                </span>
                            </div>
                        </form>
                    <!--</div>-->
                    
                </div>
                <div class="hidden-xs col-sm-5 col-md-4 col-lg-4">
                    <div id="navbar" class="navbar-collapse collapse">
                        <ul class="nav navbar-nav pull-right">
                            <li id="nav-index"><a href="index.php">首页</a></li>
                            <li id="nav-course"><a href="course.php">试卷</a></li>
                        
                                                            <li id="nav-user" class="dropdown">
                                    <a href="#user" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">个人 <span class="caret"></span></a>
                                    <ul class="dropdown-menu pull-right">
                                        <li><a href="userhome.html">个人主页</a></li>
                                        <li><a href="basic.html">资料设置</a></li>
                                        <li><a href="/user/logout" class="logout">退出登录</a></li>
                                    </ul>
                                </li>
                        </ul>
                    </div>
                </div>
                <div class="visible-xs-block col-xs-2">
                    <div class="nav nav-hamburger pull-right">
                        <a href="#ham" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="glyphicon glyphicon-menu-hamburger" aria-hidden="true"></span></a>
                        <ul class="dropdown-menu pull-right">
                            <li><a href="index.php">首页</a></li>
                            <li><a href="/course.php">试卷</a></li>
                   
                                                            <li><a href="/userhome.html">个人主页</a></li>
                                <li><a href="/basic.html">资料设置</a></li>
                                <li><a href="/user/logout" class="logout">退出登录</a></li>
                        </ul>
                    </div>

                </div>

            </div>
        </div>
    </nav>
</header>

    <div class="content user">
        <div class="row">

            <div class="col-xs-12 col-sm-12 col-md-4 col-lg-4 col-md-push-8 col-lg-push-8">
                <div class="section profile">
                    <div class="profile-main">
                        <div class="profile-avatar">
                            <div class="info-icon">
                                <div class="box-f">
                                    <div class="box-s">
                                        <div class="box-t img-responsive" style="background-image: url(/Public/img/taeyeonHeanpic.jpg);">
                                            <div class="overlay">
                                                <a href="/User/avatar"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span></a>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <!--<img class="img-responsive img-circle avatar-l center-block" src="/Public/images/default-avatar.png" />-->
                        </div>
                        <div class="profile-name f-18">181433622_qq<span class="f-sub"></span></div>
                        <div class="profile-block">
                            <span class="f-14">等级:LV <span class="f-14 f-main">0</span></span>
                        </div>
                        <div class="profile-block">
                            <div class="info-line">邮箱: <span>181433622@qq.com</span></div>
                            <div class="info-line">所在地: <span>未填写</span></div>
                        </div>
                    </div>
                    <div class="actions clearfix">
                        <a role="button" class="btn btn-primary" href="basic.html">设置</a>
                    </div>
                </div>


            </div>

            <div class="col-xs-12 col-sm-12 col-md-8 col-lg-8 col-md-pull-4 col-lg-pull-4">

                <div class="section">
                    <!-- Nav tabs -->
                    <nav>
                        <ul class="nav nav-tabs">
                            <li role="presentation" class="active"><a id="news-tab" href="#feeds" aria-controls="feeds" role="tab" data-toggle="tab">做题记录</a></li>
                            <li role="presentation"><a id="courses-tab" href="#courses" aria-controls="courses" role="tab" data-toggle="tab">错题集</a></li>
                        </ul>
                    </nav>

                    <!-- Tab panes -->
                    <div class="tab-content">
                        <!-- Tab Feeds -->
                        <div class="tab-content">
                        <!-- Tab Feeds -->
                        <ul role="tabpanel" class="tab-pane fade in active" id="feeds">
                                                            <div class="no-item">
                                                                <table>
                        <?php
                                        require_once './function.php';

                                        $json = do_post_request("http://localhost:9095/getuserhistory");
                                        $list = json_decode($json, true);
                                        
                                        foreach ($list as $item){
                                            echo '
                                                <tr>
                                                <td>'.$item['listenName'].'</td>
                                                    <td>'.$item['listenScore'].'</td>
                                                </tr>
                                             ';
                                        }
                        ?>
                                         </table>                   </div>                        </ul>
                        <!-- Tab Courses -->

                        <ul role="tabpanel" class="tab-pane fade" id="courses" href="#courses">
                            <?php
                                        require_once './function.php';

                                        $json = do_post_request("http://localhost:9095/geterrorlisten");
                                        $list = json_decode($json, true);
                                        
                                        foreach ($list as $item){
                                            echo '
                                                <tr>
                                                <td>'.$item['listenName'].'</td>
                                                    <td>'.$item['number'].'</td>
                                                        <td>'.$item['listenText'].'</td>
                                                            <td>'.$item['listenAnswer'].'</td>
                                                </tr>
                                             ';
                                        }
                        ?>
                             
                        </ul>
                    </div>
                </div>

            </div>

        </div>
    </div>

</div>
<script src="/Public/js/header.js" ></script>
<script src="/Public/js/jquery.toaster.js"></script>
<script src="http://malsup.github.io/jquery.form.js"></script>
<script src="/Public/js/notice.js"></script>
<script src="//cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script src="/Public/js/bootstrap-datetimepicker.min.js"></script>
<script src="/Public/js/bootstrap-datetimepicker.zh-CN.js"></script>
<script src="/Public/js/settings.js"></script>


<script>
    $("#nav-user").addClass('active');
</script>
<script>
    function onload(){
//      var list1=document.getElementById("list1");
//      var list2=document.getElementById("list2");
      $.get(
             "http://localhost:9095/getuserstatus",
     {
         
     },
     function(data)
     {
         if(data){
//             alert("yes");
//            $('.log-or-sign').hide();
//            list1.style.display="none";
//            list2.style.display="block";
         }
         else{
//             alert("no");
         }
     }
                );
  }
  window.reload=onload();
  function name_load(){
      var name=document.getElementById("name");
      $.get(
             "http://localhost:9095/getusername",
     {
         
     },
     function(data){
         name.innerText=data;
     }
                )
  }
  window.reload=name_load();
  function email_load(){
      var email=document.getElementById("email");
      $.get(
             "http://localhost:9095/getuseremail",
     {
         
     },
     function(data){
         email.innerText=data;
     }
                )
  }
  window.reload=email_load();
  function city_load(){
      var city=document.getElementById("city");
      $.get(
             "http://localhost:9095/getusercity",
     {
         
     },
     function(data){
         city.innerText=data;
     }
                )
  }
  window.reload=city_load();
</script>
    </div>
    </body>
</html>